Skip to content

Prevent concurrent database health checks from sharing a single connection - #1733

Merged
TimHess merged 2 commits into
mainfrom
fix/db-health-contributor-concurrency
Sep 8, 2026
Merged

TimHess merged 2 commits into
mainfrom
fix/db-health-contributor-concurrency

Conversation

@TimHess

@TimHess TimHess commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Description

  • Update RelationalDatabaseHealthContributor to take a connection factory so each health check manages its own connection, avoiding overlapping checks opening and closing the same connection at the same time.
  • Pass the database type name directly to skip reflection.

Fixes #1732

Quality checklist

  • Your code complies with our Coding Style.
  • You've updated unit and/or integration tests for your change, where applicable.
  • You've updated documentation for your change, where applicable.
    If your change affects other repositories, such as Documentation and/or Samples, add linked PRs here.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.
  • You've added required license files and/or file headers (explaining where the code came from with proper attribution), where code is copied from StackOverflow, a blog, or OSS.

@TimHess TimHess added the Component/Connectors Issues related to Steeltoe connectors label Aug 21, 2026
@TimHess TimHess added this to the 4.3.0 milestone Aug 21, 2026
@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary - All Code Coverage (ubuntu-latest)

Line coverage Branch coverage

Assembly Line coverage Branch coverage
Steeltoe.Bootstrap.AutoConfiguration 97.4% 83.3%
Steeltoe.Common 86.4% 77%
Steeltoe.Common.Certificates 97.2% 80.2%
Steeltoe.Common.Hosting 83.5% 65%
Steeltoe.Common.Http 97.4% 80.9%
Steeltoe.Common.Logging 81.1% 56.2%
Steeltoe.Common.Net 64.5% 66.6%
Steeltoe.Configuration.Abstractions 96.3% 89.4%
Steeltoe.Configuration.CloudFoundry 98.4% 92.7%
Steeltoe.Configuration.ConfigServer 91.6% 86.2%
Steeltoe.Configuration.Encryption 97.6% 87.8%
Steeltoe.Configuration.Kubernetes.ServiceBindings 95.6% 82.6%
Steeltoe.Configuration.Placeholder 93.8% 82.6%
Steeltoe.Configuration.RandomValue 93.2% 83.3%
Steeltoe.Configuration.SpringBoot 98.3% 85%
Steeltoe.Connectors 94.4% 85.3%
Steeltoe.Connectors.EntityFrameworkCore 81% 65.3%
Steeltoe.Discovery.Configuration 96.3% 75%
Steeltoe.Discovery.Consul 91.5% 84%
Steeltoe.Discovery.Eureka 91.4% 81.3%
Steeltoe.Discovery.HttpClients 89.9% 91.4%
Steeltoe.Logging.Abstractions 99.4% 95.6%
Steeltoe.Logging.DynamicConsole 100% 92.3%
Steeltoe.Logging.DynamicSerilog 99.1% 95.4%
Steeltoe.Management.Abstractions 100% 100%
Steeltoe.Management.Endpoint 96% 87.1%
Steeltoe.Management.GitProperties.Build 95.1% 83.9%
Steeltoe.Management.Prometheus 95.8% 76.9%
Steeltoe.Management.Tasks 95.2% 80%
Steeltoe.Management.Tracing 100% 75%
Steeltoe.Security.Authentication.JwtBearer 100% 93.7%
Steeltoe.Security.Authentication.OpenIdConnect 87.7% 66.6%
Steeltoe.Security.Authorization.Certificate 95.6% 61.5%
Steeltoe.Security.DataProtection.Redis 100% ****

@TimHess
TimHess force-pushed the fix/db-health-contributor-concurrency branch from 6dac9d4 to a00b2c8 Compare August 21, 2026 19:50
@TimHess
TimHess marked this pull request as ready for review August 21, 2026 19:59
@TimHess
TimHess requested a review from bart-vmware August 21, 2026 21:46
Comment thread src/Connectors/test/Connectors.Test/RelationalDatabaseHealthContributorTest.cs Outdated

@bart-vmware bart-vmware left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except for the added test.

@bart-vmware

Copy link
Copy Markdown
Member

This PR targets another PR. Please rebase on main, so it can be merged independently.

Base automatically changed from build-4.3.0 to main September 8, 2026 14:42
TimHess and others added 2 commits September 8, 2026 10:05
- Update RelationalDatabaseHealthContributor to take a connection factory so each health check manages its own connection, avoiding overlapping checks opening and closing the same connection at the same time.
- Pass the database type name directly to skip reflection.

Co-Authored-By: Claude <noreply@anthropic.com>
@TimHess
TimHess force-pushed the fix/db-health-contributor-concurrency branch from a00b2c8 to 7a25f8a Compare September 8, 2026 15:07
@TimHess
TimHess requested a review from bart-vmware September 8, 2026 15:08
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@TimHess
TimHess merged commit 5d815d4 into main Sep 8, 2026
17 of 18 checks passed
@TimHess
TimHess deleted the fix/db-health-contributor-concurrency branch September 8, 2026 15:56
@bart-vmware bart-vmware added the ReleaseLine/4.x Identified as a feature/fix for the 4.x release line label Sep 10, 2026
bart-vmware added a commit that referenced this pull request Oct 9, 2026
* Fix MongoDB health checks similar to #1733, ensuring proper disposal whether CacheConnection is true or false

* Wrap in using statement

* Change ServiceName property to non-nullable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component/Connectors Issues related to Steeltoe connectors ReleaseLine/4.x Identified as a feature/fix for the 4.x release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.InvalidOperationException: Invalid operation. The connection is closed

2 participants